//
//  ViewController.swift
//  05CollectionView
//
//  Created by Clover on 2018/4/16.
//  Copyright © 2018年 youbing. All rights reserved.
//

import UIKit

class ViewController: UIViewController {

    @IBOutlet weak var collection: UICollectionView!
    
    var interests = interest.getInterest()
    
    override func viewDidLoad() {
        super.viewDidLoad()
    }
    
    fileprivate struct Storyboard {
        static let CellIdentifier = "CollectionViewCell"
    }
    
}

extension ViewController : UICollectionViewDataSource{
    func numberOfSections(in collectionView: UICollectionView) -> Int {
        return 1
    }
    
    func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
        return interests.count
    }
    
    func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
        let cell = collectionView.dequeueReusableCell(withReuseIdentifier: Storyboard.CellIdentifier, for: indexPath) as! CollectionViewCell
        
        cell.interest = self.interests[indexPath.item]
        
        return cell
        
    }
}

